export function useSysTheme() {
  const themeMedia = window.matchMedia('(prefers-color-scheme: light)')
  themeMedia.addEventListener('change', (event) => {
    if (event.matches) {
      document.documentElement.classList.remove('dark')
    } else {
      document.documentElement.classList.add('dark')
    }
  })

  const event = new MediaQueryListEvent('change', {
    matches: themeMedia.matches,
    media: themeMedia.media
  })
  themeMedia.dispatchEvent(event)
}
